import { Component, OnInit, Input } from '@angular/core';
import {ActivatedRoute, Router} from "@angular/router";

@Component({
  selector: 'app-liuyu-map',
  templateUrl: './liuyu-map.component.html',
  styleUrls: ['./liuyu-map.component.css']
})

export class LiuyuMapComponent implements OnInit {
  @Input() public startTime:string;
  @Input() public endTime:string;
	public arr:Array<any> = [{
    id: 0,
    isShow: false,
    country: '洪家渡',
    left: 235,
    top: 306,
    navigator: true
  },{
    id: 1,
    isShow: false,
    country: '乌江渡',
    left: 351,
    top: 241
  },{
    id: 2,
    isShow: false,
    country: '东风',
    left: 273,
    top: 311
  },{
    id: 3,
    isShow: false,
    country: '沙沱',
    left: 593,
    top: 57
  },{
    id: 4,
    isShow: false,
    country: '思林',
    left: 549,
    top: 170
  },{
    id: 5,
    isShow: false,
    country: '构皮滩',
    left: 472,
    top: 232
  },{
    id: 6,
    isShow: false,
    country: '格里桥',
    left: 413,
    top: 291
  },{
    id: 7,
    isShow: false,
    country: '大花水',
    left: 420,
    top: 318
  }]
  // },{
  //   id: 9,
  //   isShow: false,
  //   country: '引子渡',
  //   left: 274,
  //   top: 350
  // }]
  public isShow2:boolean = false
  constructor(
  	private router: Router
  ){
  }
  show2(){
    this.isShow2 = true;
  }
  hide2() {
    this.isShow2 = false;
  }
  show4(num:number){
    this.arr[num].isShow = true;
  }
  hide4(num:number) {
    this.arr[num].isShow = false;
  }
  navigator(num:number) {
    if(this.startTime&&this.arr[num].id == 0) {
      this.router.navigate(['/pages/performance-analysis/station-overview',5,{startTime:this.startTime, endTime:this.endTime}])
    }
    if(!this.startTime&&this.arr[num].navigator) {
      this.router.navigate(['/pages/exhibition/station-overview',5])
    }
  }
  navigator2() {
    if(this.startTime) {
      this.router.navigate(['/pages/performance-analysis/station-overview',6,{startTime:this.startTime, endTime:this.endTime}])
    }
  }
  setStyles(num:number) {
    let style = {
       'left': this.arr[num].left + 'px',
       'top': this.arr[num].top + 'px'
    }
    return style;
  }
  ngOnInit() {
  }

}
